package org.jakim.entity;

import java.io.Serializable;
import java.util.Date;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.apache.tomcat.util.http.fileupload.FileItem;

@Entity
@Table(name = "PERSONAL_INFO")
public class PersonalInforamation implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue
	@Column(name = "PESRONAL_INFO_ID")
	private Integer PersonalInforamationID;

	@Column(name = "USER_FIRST_NAME")
	private String userName;

	@Column(name = "USER_SIR_NAME")
	private String userSirName;

	@Column(name = "USER_BIRTH_DATE")
	private Date userBirthDay;

	@Column(name = "USER_PHONE")
	private String phoneNumber;

	@Column(name = "USER_EMAIL")
	private String userEmail;

	@OneToOne(cascade = CascadeType.ALL)
	@JoinColumn(name = "PESRONAL_INFO_ID")
	private UserAddress userAddress;
	
	@OneToMany(cascade = CascadeType.ALL)
	@JoinColumn(name = "PESRONAL_INFO_ID")
	private Set<PersonalSkill> personalSkills;
	
	@OneToMany(cascade = CascadeType.ALL)
	@JoinColumn(name = "PESRONAL_INFO_ID")
	private Set<WorkExperience> workExperiences;

	@Column(name = "USER_GENDER")
	private String userGender;

	@Column(name = "USER_NATIONALITY")
	private String userNationality;

	@Column(name = "PERSONAL_PICTURE")
	private FileItem userImage;
	
	public FileItem getUserImage() {
		return userImage;
	}

	public void setUserImage(FileItem userImage) {
		this.userImage = userImage;
	}

	@ManyToOne()
	@JoinColumn(name = "USER_ID")
	private User user;

	public PersonalInforamation() {

	}

	public PersonalInforamation(String phoneNumber, UserAddress userAddress,
			Date userBirthDay, String userGender, String userName,
			String userSirName, String userNationality, String userEmail,
			User user) {
		super();
		this.phoneNumber = phoneNumber;
		this.userAddress = userAddress;
		this.userBirthDay = userBirthDay;
		this.userGender = userGender;
		this.userName = userName;
		this.userSirName = userSirName;
		this.userNationality = userNationality;
		this.userEmail = userEmail;
		this.user = user;
	}

	public Integer getPersonalInforamationID() {
		return PersonalInforamationID;
	}

	public void setPersonalInforamationID(Integer personalInforamationID) {
		PersonalInforamationID = personalInforamationID;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getUserSirName() {
		return userSirName;
	}

	public void setUserSirName(String userSirName) {
		this.userSirName = userSirName;
	}

	public Date getUserBirthDay() {
		return userBirthDay;
	}

	public void setUserBirthDay(Date userBirthDay) {
		this.userBirthDay = userBirthDay;
	}

	public String getPhoneNumber() {
		return phoneNumber;
	}

	public void setPhoneNumber(String phoneNumber) {
		this.phoneNumber = phoneNumber;
	}

	public String getUserEmail() {
		return userEmail;
	}

	public void setUserEmail(String userEmail) {
		this.userEmail = userEmail;
	}

	public UserAddress getUserAddress() {
		return userAddress;
	}

	public void setUserAddress(UserAddress userAddress) {
		this.userAddress = userAddress;
	}

	public String getUserGender() {
		return userGender;
	}

	public void setUserGender(String userGender) {
		this.userGender = userGender;
	}

	public String getUserNationality() {
		return userNationality;
	}

	public void setUserNationality(String userNationality) {
		this.userNationality = userNationality;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}
	

}
